<?php

session_start();

header('Content-Type: application/json');

class MyDB extends SQLite3 {
	function __construct() {
		$this->open('access.db');
	}
}

$db = new MyDB();

if(!$db) { 
		echo $db->lastErrorMsg();
}

$json = array();

$count_sql = "select count(id) as count from access_".$_SESSION["uid"];

$results = $db->query($count_sql);
	while ($row = $results->fetchArray(SQLITE3_ASSOC)) {
		$count = $row['count'];
	}

function is_odd($number)
{
 return ($number % 2 ? true : false);
}

echo json_encode(is_odd($count) ? 'pracuje' : 'nie pracuje');

$db->close();

?>